<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=no" />
<base href="../" />

<!-- oktavia -->
<link rel="stylesheet" href="assets/searchstyle.css" type="text/css" />
<script src="search/jquery-1.9.1.min.js"></script>
<script src="search/oktavia-jquery-ui.js"></script>
<script src="search/oktavia-english-search.js"></script>
<!-- /oktavia -->

<link rel="stylesheet" href="assets/style.css" type="text/css" />

<title>Using h2olog for Tracing - Configure - H2O - the optimized HTTP server</title>
</head>
<body>
<div id="body">
<div id="top">

<h1>
<a href="index.html">H2O</a>
</h1>
<p class="description">the optimized HTTP/1.x, HTTP/2, HTTP/3 server</p>

<!-- oktavia -->
<form id="searchform">
<input class="search" type="search" name="search" id="search" results="5" value="" placeholder="Search" />
<div id="searchresult_box">
<div id="close_search_box">&times;</div>
<div id="searchresult_summary"></div>
<div id="searchresult"></div>
<div id="searchresult_nav"></div>
<span class="pr">Powered by <a href="https://github.com/shibukawa/oktavia">Oktavia</a></span>
</div>
</form>
<!-- /oktavia -->

</div>

<table id="menu">
<tr>
<td><a href="index.html">Top</a></td>
<td><a href="install.html">Install</a></td>
<td class="selected"><a href="configure.html">Configure</a></td>
<td><a href="faq.html">FAQ</a></td>
<td><a href="http://blog.kazuhooku.com/search/label/H2O" target="_blank">Blog</a></td>
<td><a href="http://github.com/h2o/h2o/" target="_blank">Source</a></td>
</tr>
</table>

<div id="main">

<h2>
<a href="configure.html">Configure</a> &gt;
Using h2olog for Tracing
</h2>


<p>h2olog is an experimental <a href="https://www.kernel.org/doc/html/latest/bpf/index.html">BPF</a> (<a href="https://www.kernel.org/doc/Documentation/networking/filter.txt">kernel doc</a>) backed tracing tool for the <a href="https://github.com/h2o/h2o">H2O</a> server.
It can be used for tracing quicly and h2o USDT probes.</p>

<p><em>Since h2olog is an experimental program, its command-line interface might change without notice.</em></p>

<h2 id="installing-from-source">Installing from Source</h2>

<p>See <a href="#requirements">requirements</a> for build prerequisites.</p>
<p>If dependencies are satisfied, h2olog is built automatically. It is possible to manually turn on / off the build of h2olog by using the <code>-DWITH_H2OLOG</code> option. This option takes either <code>ON</code>> or <code>OFF</code> as the argument.</p>
<p>If you have <code>BCC</code> installed to a non-standard path, use <code>pkg-config</code> for <code>cmake</code>.

<pre><code>$ PKG_CONFIG_PATH=/path/to/bcc/lib/pkgconfig cmake [options]
</code></pre>

<h2 id="requirements">Requirements</h2>

<h3>For building h2olog</h3>
<ul>
<li>C++11 compiler</li>
<li>CMake for generating the build files</li>
<li>pkg-config for detecting dependencies</li>
<li>Python 3 for the code generator</li>
<li><a href="https://iovisor.github.io/bcc/">BCC</a> (BPF compiler collection, a.k.a. bpfcc; &gt;= 0.11.0) <a href="https://github.com/iovisor/bcc/blob/master/INSTALL.md">installed</a> on your system</li>
</ul>
<p>For Ubuntu 20.04 or later, you can install dependencies with:</p>
<pre><code>$ sudo apt install clang cmake python3 libbpfcc-dev linux-headers-$(uname -r)
</code></pre>
<h3>For running h2olog</h3>
<ul>
<li>Root privilege to execute h2olog</li>
<li>Linux kernel (&gt;= 4.10)</li>
</ul>

<h2 id="quicstart">Quickstart</h2>
<p><code>h2olog -H -p $H2O_PID</code> shows <a href="https://varnish-cache.org/docs/trunk/reference/varnishlog.html">varnishlog</a>-like tracing.</p>

<pre><code>$ sudo h2olog -H -p $(pgrep -o h2o)

11 0 RxProtocol HTTP/3.0
11 0 RxHeader   :authority torumk.com
11 0 RxHeader   :method GET
11 0 RxHeader   :path /
11 0 RxHeader   :scheme https
11 0 TxStatus   200
11 0 TxHeader   content-length 123
11 0 TxHeader   content-type text/html
... and more ...
</code></pre>

<h2 id="tracing-usdt-events">Tracing USDT events</h2>
<p>Server-side <a href="https://en.wikipedia.org/wiki/QUIC">QUIC</a> events can be traced using the <code>quic</code> subcommand.
Events are rendered in <a href="https://jsonlines.org/">JSON Lines</a> format.</p>

<pre><code>$ sudo h2olog -p $(pgrep -o h2o)
</code></pre>

<p>Here’s an example trace.</p>

<pre><code>{&quot;time&quot;:1584380825832,&quot;type&quot;:&quot;accept&quot;,&quot;conn&quot;:1,&quot;dcid&quot;:&quot;f8aa2066e9c3b3cf&quot;}
{&quot;time&quot;:1584380825835,&quot;type&quot;:&quot;crypto-decrypt&quot;,&quot;conn&quot;:1,&quot;pn&quot;:0,&quot;len&quot;:1236}
{&quot;time&quot;:1584380825832,&quot;type&quot;:&quot;quictrace-recv&quot;,&quot;conn&quot;:1,&quot;pn&quot;:0}
{&quot;time&quot;:1584380825836,&quot;type&quot;:&quot;crypto-handshake&quot;,&quot;conn&quot;:1,&quot;ret&quot;:0}
... and more ...
</code></pre>




</div>
<div id="footer">
<p>
Copyright &copy; 2015-2025 <a href="http://dena.com/intl/">DeNA Co., Ltd.</a> et al.
</p>
</div>
</body>
</html>
